// Copyright 2022 Hollson. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.

package leetcode1

import (
	"fmt"
)

// 题目：要求输出国际象棋棋盘
//  复杂度：O(n^2)
//  要点：判断坐标和的奇偶性
//  解读：理解直角坐标系的变化规律
func Chess(x, y int) {
	black := "\033[40;37m  \033[0m" // 空格字符色块
	white := "\033[40;47m  \033[0m"
	for i := 0; i < x; i++ {
		for j := 0; j < y; j++ {
			if (i+j)%2 == 0 {
				fmt.Printf(white)
				continue
			}
			fmt.Printf(black)
		}
		fmt.Println()
	}
}
